{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "914d270b-508b-4c4c-b5da-99374746baef",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 环境导入\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.rcParams['font.sans-serif'] = 'SimHei'\n",
    "plt.rcParams['axes.unicode_minus'] = False"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6a48c675-eacc-4b85-b5c7-6a99e87a4304",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 2913 entries, 0 to 2912\n",
      "Data columns (total 9 columns):\n",
      " #   Column  Non-Null Count  Dtype \n",
      "---  ------  --------------  ----- \n",
      " 0   标题      2913 non-null   object\n",
      " 1   地区      2913 non-null   object\n",
      " 2   公司名     2913 non-null   object\n",
      " 3   公司领域    2913 non-null   object\n",
      " 4   薪资      2913 non-null   object\n",
      " 5   经验      2913 non-null   object\n",
      " 6   规模      2913 non-null   object\n",
      " 7   福利      2531 non-null   object\n",
      " 8   详情页     2913 non-null   object\n",
      "dtypes: object(9)\n",
      "memory usage: 204.9+ KB\n"
     ]
    }
   ],
   "source": [
    "position_df = pd.read_excel(\"boss岗位.xlsx\")\n",
    "position_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "13318c7b-957d-445c-87cb-9a4bf0be9fb2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除详情页列\n",
    "position_df.drop(columns='详情页', inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "92bed7d2-5458-41a7-bf7c-2ce253ce3e74",
   "metadata": {},
   "outputs": [],
   "source": [
    "#筛选爬虫岗位，数据分析师岗位，大数据开发岗位\n",
    "df= position_df[(position_df['标题'].str.contains(\"爬虫\")) | (position_df['标题'] == '数据分析师')|(position_df['标题'] == '大数据开发')]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4b55ea83-1210-4ec1-bcc2-871841042875",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['最低薪资']=df['薪资'].str.extract('^(\\d+).*')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:3: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['最高薪资']=df['薪资'].str.extract('^.*?-(\\d+).*')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:6: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['提成']=df['薪资'].str.extract('^.*?·(\\d{2})薪')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:7: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
      "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
      "\n",
      "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
      "\n",
      "\n",
      "  df['提成'].fillna(12,inplace=True)\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:7: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['提成'].fillna(12,inplace=True)\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:8: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['提成']=df['提成'].astype('float64')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\3200232915.py:9: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['提成']=df['提成']/12\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>标题</th>\n",
       "      <th>地区</th>\n",
       "      <th>公司名</th>\n",
       "      <th>公司领域</th>\n",
       "      <th>薪资</th>\n",
       "      <th>经验</th>\n",
       "      <th>规模</th>\n",
       "      <th>福利</th>\n",
       "      <th>最低薪资</th>\n",
       "      <th>最高薪资</th>\n",
       "      <th>提成</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·公主坟</td>\n",
       "      <td>锐捷网络</td>\n",
       "      <td>通信/网络设备</td>\n",
       "      <td>20-30K·13薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...</td>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>1.083333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>上海·浦东新区·张江</td>\n",
       "      <td>中电金信</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15-25K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶</td>\n",
       "      <td>15</td>\n",
       "      <td>25</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·大兴区·亦庄</td>\n",
       "      <td>沃东天骏信息技术</td>\n",
       "      <td>电子商务</td>\n",
       "      <td>30-60K·14薪</td>\n",
       "      <td>5-10年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...</td>\n",
       "      <td>30</td>\n",
       "      <td>60</td>\n",
       "      <td>1.166667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·马连洼</td>\n",
       "      <td>滴滴</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>15-30K·15薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>定期体检，补充医疗保险，五险一金</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·清河</td>\n",
       "      <td>小米</td>\n",
       "      <td>互联网</td>\n",
       "      <td>15-30K·14薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.166667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2906</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·雨花台区·铁心桥</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>13-26K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利</td>\n",
       "      <td>13</td>\n",
       "      <td>26</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2909</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·江宁区·秣陵</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>12-23K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2910</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·江宁区·秣陵</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15-30K</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2911</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>桂林·临桂区·花生唐</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15-20K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2912</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>威海·环翠区·草庙子</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>10-15K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>536 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         标题           地区       公司名     公司领域          薪资       经验          规模  \\\n",
       "0     数据分析师   北京·海淀区·公主坟      锐捷网络  通信/网络设备  20-30K·13薪   3-5年本科  1000-9999人   \n",
       "1     数据分析师   上海·浦东新区·张江      中电金信    计算机软件      15-25K   经验不限本科    10000人以上   \n",
       "2     数据分析师    北京·大兴区·亦庄  沃东天骏信息技术     电子商务  30-60K·14薪  5-10年本科    10000人以上   \n",
       "3     数据分析师   北京·海淀区·马连洼        滴滴    移动互联网  15-30K·15薪   3-5年本科  1000-9999人   \n",
       "4     数据分析师    北京·海淀区·清河        小米      互联网  15-30K·14薪   3-5年本科    10000人以上   \n",
       "...     ...          ...       ...      ...         ...      ...         ...   \n",
       "2906  大数据开发  南京·雨花台区·铁心桥      中软国际    计算机软件      13-26K   经验不限本科    10000人以上   \n",
       "2909  大数据开发    南京·江宁区·秣陵      中软国际    计算机软件      12-23K   1-3年本科    10000人以上   \n",
       "2910  大数据开发    南京·江宁区·秣陵      中软国际    计算机软件      15-30K   3-5年本科    10000人以上   \n",
       "2911  大数据开发   桂林·临桂区·花生唐      中软国际    计算机软件      15-20K   1-3年本科    10000人以上   \n",
       "2912  大数据开发   威海·环翠区·草庙子      中软国际    计算机软件      10-15K   经验不限本科    10000人以上   \n",
       "\n",
       "                                                     福利 最低薪资 最高薪资        提成  \n",
       "0     通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...   20   30  1.083333  \n",
       "1                      定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶   15   25  1.000000  \n",
       "2     加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...   30   60  1.166667  \n",
       "3                                      定期体检，补充医疗保险，五险一金   15   30  1.250000  \n",
       "4         餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假   15   30  1.166667  \n",
       "...                                                 ...  ...  ...       ...  \n",
       "2906    免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利   13   26  1.000000  \n",
       "2909    带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补   12   23  1.000000  \n",
       "2910    免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶   15   30  1.000000  \n",
       "2911    五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶   15   20  1.000000  \n",
       "2912    餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金   10   15  1.000000  \n",
       "\n",
       "[536 rows x 11 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#薪资清洗\n",
    "df['最低薪资']=df['薪资'].str.extract('^(\\d+).*')\n",
    "df['最高薪资']=df['薪资'].str.extract('^.*?-(\\d+).*')\n",
    "df['最高薪资'].fillna(df['最低薪资'])\n",
    "\n",
    "df['提成']=df['薪资'].str.extract('^.*?·(\\d{2})薪')\n",
    "df['提成'].fillna(12,inplace=True)\n",
    "df['提成']=df['提成'].astype('float64')\n",
    "df['提成']=df['提成']/12\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b238fd1a-daf8-44f8-a591-2f3980d3454f",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\2430435106.py:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['最低薪资'] = df['最低薪资'].astype('int64')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\2430435106.py:2: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['最高薪资'] = df['最高薪资'].astype('int64')\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\2430435106.py:3: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['平均薪资'] = (df['最低薪资']+df['最高薪资'])/2*df['提成']\n",
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\2430435106.py:4: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df['平均薪资'] = df['平均薪资'].astype('int64')\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>标题</th>\n",
       "      <th>地区</th>\n",
       "      <th>公司名</th>\n",
       "      <th>公司领域</th>\n",
       "      <th>最低薪资</th>\n",
       "      <th>最高薪资</th>\n",
       "      <th>提成</th>\n",
       "      <th>平均薪资</th>\n",
       "      <th>薪资</th>\n",
       "      <th>经验</th>\n",
       "      <th>规模</th>\n",
       "      <th>福利</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·公主坟</td>\n",
       "      <td>锐捷网络</td>\n",
       "      <td>通信/网络设备</td>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>1.083333</td>\n",
       "      <td>27</td>\n",
       "      <td>20-30K·13薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>上海·浦东新区·张江</td>\n",
       "      <td>中电金信</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>25</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>20</td>\n",
       "      <td>15-25K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·大兴区·亦庄</td>\n",
       "      <td>沃东天骏信息技术</td>\n",
       "      <td>电子商务</td>\n",
       "      <td>30</td>\n",
       "      <td>60</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>52</td>\n",
       "      <td>30-60K·14薪</td>\n",
       "      <td>5-10年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·马连洼</td>\n",
       "      <td>滴滴</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.250000</td>\n",
       "      <td>28</td>\n",
       "      <td>15-30K·15薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>定期体检，补充医疗保险，五险一金</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京·海淀区·清河</td>\n",
       "      <td>小米</td>\n",
       "      <td>互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>26</td>\n",
       "      <td>15-30K·14薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2906</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·雨花台区·铁心桥</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>13</td>\n",
       "      <td>26</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>19</td>\n",
       "      <td>13-26K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2909</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·江宁区·秣陵</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>12-23K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2910</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京·江宁区·秣陵</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>22</td>\n",
       "      <td>15-30K</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2911</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>桂林·临桂区·花生唐</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>15-20K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2912</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>威海·环翠区·草庙子</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>12</td>\n",
       "      <td>10-15K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>536 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         标题           地区       公司名     公司领域  最低薪资  最高薪资        提成  平均薪资  \\\n",
       "0     数据分析师   北京·海淀区·公主坟      锐捷网络  通信/网络设备    20    30  1.083333    27   \n",
       "1     数据分析师   上海·浦东新区·张江      中电金信    计算机软件    15    25  1.000000    20   \n",
       "2     数据分析师    北京·大兴区·亦庄  沃东天骏信息技术     电子商务    30    60  1.166667    52   \n",
       "3     数据分析师   北京·海淀区·马连洼        滴滴    移动互联网    15    30  1.250000    28   \n",
       "4     数据分析师    北京·海淀区·清河        小米      互联网    15    30  1.166667    26   \n",
       "...     ...          ...       ...      ...   ...   ...       ...   ...   \n",
       "2906  大数据开发  南京·雨花台区·铁心桥      中软国际    计算机软件    13    26  1.000000    19   \n",
       "2909  大数据开发    南京·江宁区·秣陵      中软国际    计算机软件    12    23  1.000000    17   \n",
       "2910  大数据开发    南京·江宁区·秣陵      中软国际    计算机软件    15    30  1.000000    22   \n",
       "2911  大数据开发   桂林·临桂区·花生唐      中软国际    计算机软件    15    20  1.000000    17   \n",
       "2912  大数据开发   威海·环翠区·草庙子      中软国际    计算机软件    10    15  1.000000    12   \n",
       "\n",
       "              薪资       经验          规模  \\\n",
       "0     20-30K·13薪   3-5年本科  1000-9999人   \n",
       "1         15-25K   经验不限本科    10000人以上   \n",
       "2     30-60K·14薪  5-10年本科    10000人以上   \n",
       "3     15-30K·15薪   3-5年本科  1000-9999人   \n",
       "4     15-30K·14薪   3-5年本科    10000人以上   \n",
       "...          ...      ...         ...   \n",
       "2906      13-26K   经验不限本科    10000人以上   \n",
       "2909      12-23K   1-3年本科    10000人以上   \n",
       "2910      15-30K   3-5年本科    10000人以上   \n",
       "2911      15-20K   1-3年本科    10000人以上   \n",
       "2912      10-15K   经验不限本科    10000人以上   \n",
       "\n",
       "                                                     福利  \n",
       "0     通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...  \n",
       "1                      定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶  \n",
       "2     加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...  \n",
       "3                                      定期体检，补充医疗保险，五险一金  \n",
       "4         餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假  \n",
       "...                                                 ...  \n",
       "2906    免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利  \n",
       "2909    带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补  \n",
       "2910    免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶  \n",
       "2911    五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶  \n",
       "2912    餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金  \n",
       "\n",
       "[536 rows x 12 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['最低薪资'] = df['最低薪资'].astype('int64')\n",
    "df['最高薪资'] = df['最高薪资'].astype('int64')\n",
    "df['平均薪资'] = (df['最低薪资']+df['最高薪资'])/2*df['提成']\n",
    "df['平均薪资'] = df['平均薪资'].astype('int64')\n",
    "\n",
    "cols=list(df)\n",
    "cols.insert(4,cols.pop(cols.index('最低薪资')))\n",
    "cols.insert(5,cols.pop(cols.index('最高薪资')))\n",
    "cols.insert(6,cols.pop(cols.index('提成')))\n",
    "cols.insert(7,cols.pop(cols.index('平均薪资')))\n",
    "df=df.loc[:,cols]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "f9421f16-b8a7-4705-91ae-409679602bb3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['3-5年本科', '经验不限本科', '5-10年本科', '1-3年本科', '3-5年硕士', '1年以内本科',\n",
       "       '5-10年硕士', '5天/周6个月本科', '在校/应届本科', '1-3年大专', '经验不限学历不限', '经验不限硕士',\n",
       "       '在校/应届大专', '5天/周6个月大专', '1-3年硕士', '3-5年大专', '1年以内大专', '5-10年大专',\n",
       "       '经验不限大专', '3天/周3个月本科', '4天/周4个月本科', '在校/应届学历不限', '5天/周3个月学历不限',\n",
       "       '5天/周6个月学历不限', '4天/周3个月本科', '4天/周5个月大专', '5天/周3个月本科', '3天/周5个月大专',\n",
       "       '4天/周6个月本科', '4天/周6个月硕士', '5-10年学历不限', '5天/周3个月大专', '4天/周3个月学历不限',\n",
       "       '4天/周3个月大专', '1-3年学历不限', '2天/周1个月本科', '3-5年高中', '5天/周1个月本科',\n",
       "       '6天/周6个月大专', '应届生硕士', '经验不限中专/中技', '5-10年中专/中技', '3天/周2个月本科',\n",
       "       '3天/周2个月硕士', '3天/周5个月本科', '1年以内硕士'], dtype=object)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#学历清洗\n",
    "df['经验'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "f5d8c70c-5628-4e02-b4a6-f4c2e709c333",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\hzg\\AppData\\Local\\Temp\\ipykernel_9420\\1400279745.py:2: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.\n",
      "The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.\n",
      "\n",
      "For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.\n",
      "\n",
      "\n",
      "  df['需求'].replace(np.nan,'经验不限',inplace=True)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array(['3-5年', '经验不限', '5-10年', '1-3年'], dtype=object)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['需求']=df['经验'].str.extract('^(\\d+/?-\\d+)')+'年'\n",
    "df['需求'].replace(np.nan,'经验不限',inplace=True)\n",
    "df['学历']=df['经验'].str[-2:]\n",
    "df['需求'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "377668e9-30ff-45d2-8628-e4c09317e595",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\shiXun1\\\\teamTask\\\\experience_proportion_rose_chart.html'"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts import options as opts\n",
    "\n",
    "# Clean the data by removing NaN values from the '经验' column\n",
    "df = df.dropna(subset=['需求'])\n",
    "\n",
    "# Calculate the proportion of each experience requirement\n",
    "experience_counts = df['需求'].value_counts().reset_index()\n",
    "experience_counts.columns = ['需求', '数量']\n",
    "\n",
    "# Prepare data for the Pie chart\n",
    "data = [list(z) for z in zip(experience_counts['需求'], experience_counts['数量'])]\n",
    "\n",
    "# Create a Pie chart\n",
    "pie = Pie()\n",
    "pie.add(\"\", data, radius=[\"30%\", \"75%\"], rosetype=\"radius\")\n",
    "pie.set_global_opts(title_opts=opts.TitleOpts(title=\"工作经验占比要求\"))\n",
    "pie.set_series_opts(label_opts=opts.LabelOpts(formatter=\"{b}: {c} ({d}%)\"))\n",
    "\n",
    "# Render the chart\n",
    "pie.render(\"experience_proportion_rose_chart.html\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "236c01b6-c395-4a67-b745-47943b56e644",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>标题</th>\n",
       "      <th>地区</th>\n",
       "      <th>公司名</th>\n",
       "      <th>公司领域</th>\n",
       "      <th>最低薪资</th>\n",
       "      <th>最高薪资</th>\n",
       "      <th>提成</th>\n",
       "      <th>平均薪资</th>\n",
       "      <th>薪资</th>\n",
       "      <th>经验</th>\n",
       "      <th>规模</th>\n",
       "      <th>福利</th>\n",
       "      <th>需求</th>\n",
       "      <th>学历</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>锐捷网络</td>\n",
       "      <td>通信/网络设备</td>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>1.083333</td>\n",
       "      <td>27</td>\n",
       "      <td>20-30K·13薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>上海</td>\n",
       "      <td>中电金信</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>25</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>20</td>\n",
       "      <td>15-25K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>沃东天骏信息技术</td>\n",
       "      <td>电子商务</td>\n",
       "      <td>30</td>\n",
       "      <td>60</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>52</td>\n",
       "      <td>30-60K·14薪</td>\n",
       "      <td>5-10年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...</td>\n",
       "      <td>5-10</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>滴滴</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.250000</td>\n",
       "      <td>28</td>\n",
       "      <td>15-30K·15薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>定期体检，补充医疗保险，五险一金</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>小米</td>\n",
       "      <td>互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>26</td>\n",
       "      <td>15-30K·14薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2906</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>13</td>\n",
       "      <td>26</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>19</td>\n",
       "      <td>13-26K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2909</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>12-23K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补</td>\n",
       "      <td>1-3</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2910</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>22</td>\n",
       "      <td>15-30K</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2911</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>桂林</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>15-20K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶</td>\n",
       "      <td>1-3</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2912</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>威海</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>12</td>\n",
       "      <td>10-15K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>483 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         标题  地区       公司名     公司领域  最低薪资  最高薪资        提成  平均薪资          薪资  \\\n",
       "0     数据分析师  北京      锐捷网络  通信/网络设备    20    30  1.083333    27  20-30K·13薪   \n",
       "1     数据分析师  上海      中电金信    计算机软件    15    25  1.000000    20      15-25K   \n",
       "2     数据分析师  北京  沃东天骏信息技术     电子商务    30    60  1.166667    52  30-60K·14薪   \n",
       "3     数据分析师  北京        滴滴    移动互联网    15    30  1.250000    28  15-30K·15薪   \n",
       "4     数据分析师  北京        小米      互联网    15    30  1.166667    26  15-30K·14薪   \n",
       "...     ...  ..       ...      ...   ...   ...       ...   ...         ...   \n",
       "2906  大数据开发  南京      中软国际    计算机软件    13    26  1.000000    19      13-26K   \n",
       "2909  大数据开发  南京      中软国际    计算机软件    12    23  1.000000    17      12-23K   \n",
       "2910  大数据开发  南京      中软国际    计算机软件    15    30  1.000000    22      15-30K   \n",
       "2911  大数据开发  桂林      中软国际    计算机软件    15    20  1.000000    17      15-20K   \n",
       "2912  大数据开发  威海      中软国际    计算机软件    10    15  1.000000    12      10-15K   \n",
       "\n",
       "           经验          规模                                                 福利  \\\n",
       "0      3-5年本科  1000-9999人  通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...   \n",
       "1      经验不限本科    10000人以上                   定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶   \n",
       "2     5-10年本科    10000人以上  加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...   \n",
       "3      3-5年本科  1000-9999人                                   定期体检，补充医疗保险，五险一金   \n",
       "4      3-5年本科    10000人以上      餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假   \n",
       "...       ...         ...                                                ...   \n",
       "2906   经验不限本科    10000人以上    免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利   \n",
       "2909   1-3年本科    10000人以上    带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补   \n",
       "2910   3-5年本科    10000人以上    免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶   \n",
       "2911   1-3年本科    10000人以上    五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶   \n",
       "2912   经验不限本科    10000人以上    餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金   \n",
       "\n",
       "        需求  学历  \n",
       "0      3-5  本科  \n",
       "1      NaN  本科  \n",
       "2     5-10  本科  \n",
       "3      3-5  本科  \n",
       "4      3-5  本科  \n",
       "...    ...  ..  \n",
       "2906   NaN  本科  \n",
       "2909   1-3  本科  \n",
       "2910   3-5  本科  \n",
       "2911   1-3  本科  \n",
       "2912   NaN  本科  \n",
       "\n",
       "[483 rows x 14 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#地区清洗\n",
    "df['地区'] = df['地区'].str.split('·').str[0:1].apply(lambda x: '·'.join(x))\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "4b79fc16-765c-4bb9-979b-bf5556593e58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>岗位</th>\n",
       "      <th>地区</th>\n",
       "      <th>公司名</th>\n",
       "      <th>公司领域</th>\n",
       "      <th>最低薪资</th>\n",
       "      <th>最高薪资</th>\n",
       "      <th>提成</th>\n",
       "      <th>平均薪资</th>\n",
       "      <th>薪资</th>\n",
       "      <th>经验</th>\n",
       "      <th>规模</th>\n",
       "      <th>福利</th>\n",
       "      <th>需求</th>\n",
       "      <th>学历</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>锐捷网络</td>\n",
       "      <td>通信/网络设备</td>\n",
       "      <td>20</td>\n",
       "      <td>30</td>\n",
       "      <td>1.083333</td>\n",
       "      <td>27</td>\n",
       "      <td>20-30K·13薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>上海</td>\n",
       "      <td>中电金信</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>25</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>20</td>\n",
       "      <td>15-25K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>沃东天骏信息技术</td>\n",
       "      <td>电子商务</td>\n",
       "      <td>30</td>\n",
       "      <td>60</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>52</td>\n",
       "      <td>30-60K·14薪</td>\n",
       "      <td>5-10年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...</td>\n",
       "      <td>5-10</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>滴滴</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.250000</td>\n",
       "      <td>28</td>\n",
       "      <td>15-30K·15薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>1000-9999人</td>\n",
       "      <td>定期体检，补充医疗保险，五险一金</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>北京</td>\n",
       "      <td>小米</td>\n",
       "      <td>互联网</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.166667</td>\n",
       "      <td>26</td>\n",
       "      <td>15-30K·14薪</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2906</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>13</td>\n",
       "      <td>26</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>19</td>\n",
       "      <td>13-26K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2909</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>12</td>\n",
       "      <td>23</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>12-23K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补</td>\n",
       "      <td>1-3</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2910</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>南京</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>30</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>22</td>\n",
       "      <td>15-30K</td>\n",
       "      <td>3-5年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶</td>\n",
       "      <td>3-5</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2911</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>桂林</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>15</td>\n",
       "      <td>20</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>17</td>\n",
       "      <td>15-20K</td>\n",
       "      <td>1-3年本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶</td>\n",
       "      <td>1-3</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2912</th>\n",
       "      <td>大数据开发</td>\n",
       "      <td>威海</td>\n",
       "      <td>中软国际</td>\n",
       "      <td>计算机软件</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>12</td>\n",
       "      <td>10-15K</td>\n",
       "      <td>经验不限本科</td>\n",
       "      <td>10000人以上</td>\n",
       "      <td>餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金</td>\n",
       "      <td>NaN</td>\n",
       "      <td>本科</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>483 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         岗位  地区       公司名     公司领域  最低薪资  最高薪资        提成  平均薪资          薪资  \\\n",
       "0     数据分析师  北京      锐捷网络  通信/网络设备    20    30  1.083333    27  20-30K·13薪   \n",
       "1     数据分析师  上海      中电金信    计算机软件    15    25  1.000000    20      15-25K   \n",
       "2     数据分析师  北京  沃东天骏信息技术     电子商务    30    60  1.166667    52  30-60K·14薪   \n",
       "3     数据分析师  北京        滴滴    移动互联网    15    30  1.250000    28  15-30K·15薪   \n",
       "4     数据分析师  北京        小米      互联网    15    30  1.166667    26  15-30K·14薪   \n",
       "...     ...  ..       ...      ...   ...   ...       ...   ...         ...   \n",
       "2906  大数据开发  南京      中软国际    计算机软件    13    26  1.000000    19      13-26K   \n",
       "2909  大数据开发  南京      中软国际    计算机软件    12    23  1.000000    17      12-23K   \n",
       "2910  大数据开发  南京      中软国际    计算机软件    15    30  1.000000    22      15-30K   \n",
       "2911  大数据开发  桂林      中软国际    计算机软件    15    20  1.000000    17      15-20K   \n",
       "2912  大数据开发  威海      中软国际    计算机软件    10    15  1.000000    12      10-15K   \n",
       "\n",
       "           经验          规模                                                 福利  \\\n",
       "0      3-5年本科  1000-9999人  通讯补贴，节日福利，五险一金，定期体检，带薪年假，餐补，包吃，加班补助，员工旅游，零食下午茶...   \n",
       "1      经验不限本科    10000人以上                   定期体检，节日福利，五险一金，补充医疗保险，带薪年假，零食下午茶   \n",
       "2     5-10年本科    10000人以上  加班补助，免费班车，带薪年假，定期体检，补充医疗保险，全勤奖，餐补，年终奖，股票期权，节日福...   \n",
       "3      3-5年本科  1000-9999人                                   定期体检，补充医疗保险，五险一金   \n",
       "4      3-5年本科    10000人以上      餐补，补充医疗保险，股票期权，年终奖，五险一金，定期体检，节日福利，12%公积金，带薪年假   \n",
       "...       ...         ...                                                ...   \n",
       "2906   经验不限本科    10000人以上    免费班车，五险一金，餐补，零食下午茶，年终奖，员工旅游，加班补助，带薪年假，定期体检，节日福利   \n",
       "2909   1-3年本科    10000人以上    带薪年假，员工旅游，节日福利，零食下午茶，加班补助，免费班车，定期体检，五险一金，年终奖，餐补   \n",
       "2910   3-5年本科    10000人以上    免费班车，定期体检，年终奖，加班补助，带薪年假，节日福利，五险一金，餐补，员工旅游，零食下午茶   \n",
       "2911   1-3年本科    10000人以上    五险一金，加班补助，员工旅游，年终奖，免费班车，定期体检，餐补，节日福利，带薪年假，零食下午茶   \n",
       "2912   经验不限本科    10000人以上    餐补，零食下午茶，带薪年假，免费班车，节日福利，年终奖，定期体检，员工旅游，加班补助，五险一金   \n",
       "\n",
       "        需求  学历  \n",
       "0      3-5  本科  \n",
       "1      NaN  本科  \n",
       "2     5-10  本科  \n",
       "3      3-5  本科  \n",
       "4      3-5  本科  \n",
       "...    ...  ..  \n",
       "2906   NaN  本科  \n",
       "2909   1-3  本科  \n",
       "2910   3-5  本科  \n",
       "2911   1-3  本科  \n",
       "2912   NaN  本科  \n",
       "\n",
       "[483 rows x 14 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 修改列名\n",
    "df = df.rename(columns={'标题': '岗位'})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9bd26acb-4ac6-4b23-9ca8-e068c2c0558b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c45411ce-a3b0-41d9-8a7c-eb855312e768",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "97925c09-5370-4e73-8619-3d6fd8494d32",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "70e6b804-2da5-411e-baab-d0716bf725ca",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
